package com.github.caijinglong.handler

import com.github.caijinglong.SaveDataGetter
import com.github.caijinglong.SaveDataHandler
import com.github.caijinglong.SavedDataType
import com.github.caijinglong.ext.println
import com.github.caijinglong.getGetter
import org.json.JSONArray
import org.json.JSONObject

class InfoHandler : SaveDataHandler {
    override var jsonObject: JSONObject = JSONObject()

    fun showAll() {
        println(jsonObject.toString())
    }

    companion object {
        @JvmStatic
        fun main(args: Array<String>) {
            val handler = InfoHandler()
            handler.bind(SavedDataType.ZS.getGetter())
            handler.showAll()
            handler.jsonObject.getJSONArray("relic_counters")
                    .apply {
                        val s = getInt(1)
                        remove(1)
                        this.put(1, 20)
                        println(s)
                    }
//            handler.save(SavedDataType.ZS.srcPath)
        }
    }
}